from sklearn.linear_model import LinearRegression
import numpy as np

# 创建数据
X = np.array([[1], [2], [3], [4]])
y = np.array([2, 4, 6, 8])

# 训练模型
model = LinearRegression()
model.fit(X, y)

# 预测
print("Prediction for X=5:", model.predict([[5]]))